<template>
	<view class="orderDetails">
		<TopHead :title="'配送'"></TopHead>
		<view class="conbox">
			<view class="box1">
				<AddresModel :useraddress="taskData.info.userAddress"></AddresModel>
				 
			</view>
			<view class="info-box">
		<!-- 		<view class="title-dianpu">
					 <uni-icons color="#E47917" type="home-filled" size="20"></uni-icons>  
					<image class="confirmOrder-icon1" src="/static/images/mine-icon2.png"></image>
					SN750LGD120103047
				</view> -->
				<view class="goods-Info">
					<view class="itemBox">
						<view class="iten-cont">
							<image class="item-img" :src="path+taskData.info.productEntity.logo"></image>
							<view class="iten-cont-txt">
								<view class="title2">{{taskData.info.productEntity.name}} <view class="title2-pic"> </view>
								</view>
								<view class="title3"><text>安全健康</text><text>营养</text><!-- <text class="num">X2</text> --></view>
							<!-- 	<view class="title4">规格：1件（475m*6瓶）</view> -->
							</view>
						</view>
					</view>
					
	                  <view class="otherInfo">
						<text>规格： </text>
						<view>
						<view class="otherInfo" v-for="item,index  in taskData.info.specificationList" :key="index"> 
					 		 <text>{{item.specificationName}}：</text> 
						 	<view class="sum-view" v-for="item1,index1 in item.orderItemSpecificationValueList" :key="index1">{{item1.value}}</view>  
						</view>
						</view>
						
					</view>
					
                     <view class="otherInfo">
						<text>服务时间：</text>
						<view class="sum-view">{{taskData.taskDate}}</view>
					</view>
					<view class="otherInfo">
						<text>开始服务：</text>
						<view class="sum-view">{{taskData.startTime}}</view>
					</view>
					<view class="otherInfo">
						<text>结束时间：</text>
						<view class="sum-view">{{taskData.endTime}}</view>
					</view>
				</view>
				<view class="price-view">
				<!-- 	订单金额：￥50.00 -->
				</view>
			</view>
			<view class="btnBox">
				<view class="btn1" @click="handleBegin" v-show="taskData.status==9">开始配送</view>
				<view class="btn1" @click="handleEnd" v-show="taskData.status==11">结束配送</view>
			</view>
		</view>


	</view>
</template>

<script>
	import TopHead from '../../components/topHead/topHead.vue';
	import AddresModel from '../../components/basics/addresModel.vue';

	export default {
		components: {
			TopHead,
			AddresModel
		},
		data() {
			return {	path: this.$http.tpUrl + '/', // 图片前缀
				items: [{
						value: '0',
						name: '余额',
						checked: 'true'
					},
					{
						value: '1',
						name: '微信'
					},
				],
				current: 0,
				beizhu: '',
				numer: 1, // 数量
                userInfo:{},taskId:"",
				taskData:{}
			}
		},
		onLoad(options) {
console.log('URL参数:', options);
this.taskId = options.taskId;
    console.log('taskId:', this.taskId);
		},
		onShow() {
	this.userInfo =	JSON.parse(uni.getStorageSync('user_info'));
			console.log("userInfo",this.userInfo );
			  this.initData()
		},
		onReachBottom() {
			// 触底分页
			console.log('触底')
			// if (this.total > this.list.length) {
			// 	this.page = parseInt(this.page) + 1
			// }
		},
		methods: {
			handleBegin(){
				var parms={id:this.taskData.id,status:11}
				this.modify(parms);
			},
			 
			handleEnd(){
				var parms={id:this.taskData.id,status:3}
				this.modify(parms);
			},
			modify(parms){
				let _this = this;
				var url='/wechatApplet/worker/jobTask/'+parms.id+"/"+parms.status
				_this.$http.fetchData({
					url:url ,
					method: 'PUT',
					data: parms,
					success(res) {
				if(res.code!=200){
					uni.showToast({
						title: res.msg,
						icon: 'none'
					});
					return
				}
				_this.initData();
				 
						}
							 
				})
			},
			// 数据请求示例
			initData() {
				let _this = this;
				_this.$http.fetchData({
					url: '/wechatApplet/worker/jobTask/'+_this.taskId,
					method: 'GET',
					data: {},
					success(res) {
				if(res.code!=200){
					uni.showToast({
						title: res.msg,
						icon: 'none'
					});
					return
				}
				_this.taskData=res.data;
				 
				 console.log("taskData",_this.taskData);
				 
						}
			 
				})
			},
			// dianhua
			phoneCall(item) {
				uni.makePhoneCall({
					phoneNumber: '023-62433333' //仅为示例
				});
			},
			radioChange: function(evt) {
				for (let i = 0; i < this.items.length; i++) {
					if (this.items[i].value === evt.detail.value) {
						this.current = i;
						break;
					}
				}
			},
			// 弹窗
			open() {
				this.$refs.popup.open('center')
			},
			close() {
				this.$refs.popup.close()
			},
			// 减少
			reduce() {
				if (this.numer == 1) {
					uni.showToast({
						icon: 'none',
						title: '数量不能少于1',
						duration: 2000
					})
				} else {
					this.numer--
				}
				console.log(this.numer)
			},
			addNum() {
				this.numer++
				console.log(this.numer)
			},

		}
	}
</script>

<style scoped>
	.orderDetails {
		background: #f3f3f3;
		height: 100%;
		box-sizing: border-box;
		overflow-y: auto;
	}

	.headBox {
		font-size: 36rpx;
		font-family: Microsoft YaHei, Microsoft YaHei-Bold;
		font-weight: 700;
		text-align: center;
		color: #232323;
		padding-top: 88rpx;
		padding-left: 30rpx;
		padding-right: 30rpx;
		padding-bottom: 112rpx;
		background: linear-gradient(89deg, #f9d7a6 1%, #ffdc95 100%);
	}

	.headBox .wzText {
		line-height: 56rpx;
	}

	.conbox {
		padding: 30rpx;
		padding-top: 210rpx;
		padding-bottom: 200rpx;
	}

	.box1 {
		/* display: flex; */
	}

	.box1 .left-box1 {
		flex: 1;
	}

	.title1 {
		font-size: 32rpx;
		font-family: Microsoft YaHei, Microsoft YaHei-Bold;
		font-weight: 700;
		color: #5d4529;
	}

	.title1-text {
		font-size: 24rpx;
		font-family: Microsoft YaHei, Microsoft YaHei-Regular;
		font-weight: 400;
		color: #c2c2c2;
		margin-top: 16rpx;
	}

	.box1 .right-icon-box {
		width: 132rpx;
		height: 102rpx;
	}

	.box1 .right-icon-box>view {
		width: 102rpx;
		height: 102rpx;
		background: linear-gradient(180deg, #e47917, #feefe2);
		border-radius: 50%;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.info-box {
		background: #ffffff;
		border-radius: 10rpx;
		box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(93, 69, 41, 0.25);
		padding: 24rpx;
		margin-top: 30rpx;
	}

	.title-dianpu {
		font-size: 28rpx;
		font-family: Microsoft YaHei, Microsoft YaHei-Regular;
		font-weight: 400;
		color: #5d4529;
		padding-bottom: 14rpx;
	}

	.confirmOrder-icon1 {
		width: 28rpx;
		height: 32rpx;
		display: inline-block;
		margin-right: 22rpx;
	}

	.goods-Info {
		padding: 40rpx 0;
		border-top: 2rpx dashed #c7c7c7;
		border-bottom: 2rpx dashed #c7c7c7;
	}

	.price-view {
		font-size: 32rpx;
		font-family: Microsoft YaHei, Microsoft YaHei-Bold;
		font-weight: 700;
		text-align: right;
		color: #5d4529;
		padding-top: 30rpx;
		padding-bottom: 10rpx;
	}

	.iten-cont {
		padding: 24rpx 0 32rpx 0;
		display: flex;
	}

	.iten-cont .item-img {
		flex-shrink: 0;
		width: 178rpx;
		height: 178rpx;
		border-radius: 10rpx;
		background-color: #f3f3f3;
	}

	.iten-cont-txt {
		padding-left: 18rpx;
		flex: 1;
	}

	.title2 {
		font-size: 32rpx;
		font-family: Microsoft YaHei, Microsoft YaHei-Bold;
		font-weight: 700;
		color: #5d4529;
		position: relative;
		padding-right: 110rpx;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.title2 .title2-pic {
		font-size: 24rpx;
		font-family: Microsoft YaHei, Microsoft YaHei-Regular;
		font-weight: 400;
		color: #f61111;
		line-height: 52rpx;
		position: absolute;
		right: 0;
		top: 50%;
		margin-top: -26rpx;
	}

	.title2 .title2-pic text {
		font-size: 40rpx;
	}

	.title3 {
		font-size: 24rpx;
		font-family: Microsoft YaHei, Microsoft YaHei-Regular;
		font-weight: 400;
		color: #fdab34;
		margin-top: 18rpx;
		position: relative;
	}

	.title3 text {
		display: inline-block;
		line-height: 40rpx;
		background: #fff0db;
		padding: 0 18rpx;
		margin-left: 10rpx;
		border-radius: 10rpx;
	}

	.title3 text:first-child {
		margin-left: 0;
	}

	.title3 .num {
		line-height: 32rpx;
		position: absolute;
		right: 0;
		top: 50%;
		margin-top: -16rpx;
		font-size: 24rpx;
		font-family: Microsoft YaHei, Microsoft YaHei-Regular;
		font-weight: 400;
		color: #c2c2c2;
		background: none;
		padding: 0;
		margin: 0;
	}

	.title4 {
		font-size: 24rpx;
		font-family: Microsoft YaHei, Microsoft YaHei-Regular;
		font-weight: 400;
		color: #c2c2c2;
		margin-top: 12rpx;

	}

	.otherInfo {
		font-size: 28rpx;
		font-family: Microsoft YaHei, Microsoft YaHei-Regular;
		font-weight: 400;
		color: #c2c2c2;
		margin-bottom: 24rpx;
		display: flex;
	}

	.goods-Info .otherInfo:last-child {
		margin-bottom: 0;
	}

	.otherInfo text {
		color: #7e8898;
		flex-shrink: 0;
	}

	.sum-view {
		flex: 1;
		text-align: left;
		color: #5d4529;
	}

	.uni-list-cell {
		margin-left: 80rpx;
	}

	.yhq {
		color: #e47917;
	}

	.sum-view .add1 {
		width: 34rpx;
		height: 34rpx;
		box-sizing: border-box;
		display: inline-block;
		background: #ffffff;
		border: 2rpx solid #e47917;
		border-radius: 50%;
		font-size: 22rpx;
		font-weight: 400;
		color: #000000;
		text-align: center;
	}

	.sum-view .add2 {
		background: #e47917;
		border: 2rpx solid #e47917;
		color: #fff;
	}

	.sum-view .add {
		display: inline-block;
		width: 50rpx;
		text-align: center;
		vertical-align: middle;
		color: #000;
	}

	.sum-view .active {
		color: #e47917;
	}

	.sum-view .radioText {
		color: #000;
	}

	.uni-input {
		flex: 1;
		text-align: right;
		color: #000;
	}

	.price {
		font-size: 32rpx;
		font-family: Microsoft YaHei, Microsoft YaHei-Bold;
		font-weight: 700;
		color: #5d4529;
		text-align: right;
		padding-top: 30rpx;
		padding-bottom: 36rpx;
	}

	.btnBox {
		padding: 0 80rpx;
		margin-top: 196rpx;
	}
	.btnBox .btn1 {
		background: #e47917;
		border-radius: 10rpx;
		text-align: center;
		line-height: 112rpx;
		font-size: 32rpx;
		font-family: Microsoft YaHei, Microsoft YaHei-Regular;
		font-weight: 400;
		color: #ffffff;
	}
	.btnBox .btn2 {
		font-size: 32rpx;
		font-family: Microsoft YaHei, Microsoft YaHei-Regular;
		font-weight: 400;
		text-align: center;
		color: #e47917;
		line-height: 112rpx;
		margin-top: 30rpx;
	}

	

</style>